package Concurrent.Executors;

import com.fasterxml.jackson.core.JsonProcessingException;

import java.util.Date;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by wangyg 
 * on 2017/8/10 15:33
 */
public class SimpleObj implements Runnable {
	private String objName;
	private String objDesc;
	private Integer ObjId;
	private Date createTime;

	public SimpleObj(String objName, String objDesc, Integer objId, Date createTime) throws JsonProcessingException {
		this.objName = objName;
		this.objDesc = objDesc;
		ObjId = objId;
		this.createTime = createTime;

		ExecutorService executorService = Executors.newFixedThreadPool(3);
		executorService.execute(this);
		executorService.execute(this);
		executorService.execute(this);
		executorService.shutdown();

	}

	@Override
	public void run() {

		for (int i = 0; i <=10000; i++) {
			try {
				System.out.println(Thread.currentThread().getName() + "::::::" + Printer.print(this) + "::::::" + i);
			/*	try {
					Thread.sleep(10L);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}*/
			} catch (JsonProcessingException e) {
				e.printStackTrace();
			}

		}

	}

	public static void main(String[] args) throws JsonProcessingException {
		new SimpleObj("name", "desc", 123, new Date());
	}

	public String getObjName() {
		return objName;
	}

	public void setObjName(String objName) {
		this.objName = objName;
	}

	public String getObjDesc() {
		return objDesc;
	}

	public void setObjDesc(String objDesc) {
		this.objDesc = objDesc;
	}

	public Integer getObjId() {
		return ObjId;
	}

	public void setObjId(Integer objId) {
		ObjId = objId;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

}
